﻿using System.Collections.Generic;
using GameFramework.common;
using UnityEngine;

namespace GameFramework.skill
{
    [CreateAssetMenu(fileName = "BulletConfigManager", menuName = "configs/BulletConfigManager")]
    public class BulletConfigManager:ScriptableObjectSingleton<BulletConfigManager>
    {
        private  Dictionary<int, BulletConfig> bulletConfigs = new Dictionary<int, BulletConfig>();

        public  List<BulletConfig> configs;
        
        public BulletConfig getConfig(int id)
        {
            if (bulletConfigs.Count > 0)
            {
                return bulletConfigs[id];
            }

            return null;
        }

        protected override void  init()
        {
            //TODO 代码生成，加入容器
            // configs.Add();
            if (bulletConfigs.Count == 0 && configs!=null &&  configs.Count > 0)
            {
                foreach (BulletConfig config in configs)
                {
                    bulletConfigs.Add(config.id,config);
                }
            }
        }
    }
}